export class StorageLoader { private _domStorage: storage.attached.dom.LoadStorage;
private _callbacks: StorageLoader.Callbacks = null;
private _indexedDBDetectCompleted = false;
private _webSqlDetectCompleted = false;
private _persistenceName: string = null;
private _persistence: storage.attached.LoadStorage = null;
private _storageElement: HTMLElement,
private _uniqueKey: string) { loadStorage(callbacks: StorageLoader.Callbacks) { throw new Error('Cannot load storage twice.'); this._callbacks = callbacks;
new storage.attached.dom.DetectStorage(this._storageElement, this._dom.documenOverride).
this._callbacks.detectionComplete(err, null, null, null);
var detectIndexedDB = new storage.attached.indexedDB.DetectStorage();
var detectWebSQL = new storage.attached.webSQL.DetectStorage();
detectIndexedDB.detectStorageAsync(this._uniqueKey, (error, load) => { this._indexedDBDetectCompleted = true;
if (!this._webSqlDetectCompleted)
this._persistence = load;
this._persistenceName = 'indexedDB';
detectWebSQL.detectStorageAsync(this._uniqueKey, (error, load) => { this._webSqlDetectCompleted = true;
this._persistence = load;
if (this._indexedDBDetectCompleted)
private _detectCompleted() { var loadingFromPersistence = this._persistence && this._persistence.editedUTC > this._domStorage.editedUTC;
var sourceLoad = loadingFromPersistence ? this._persistence : this._domStorage;
var targetLoad = loadingFromPersistence ? this._domStorage : this._persistence;
this._callbacks.detectionComplete(
var byFullPath: { [fullPath: string]: { [property: string]: string; }; } = {}; totalFileCount = fileCount;